package jgl.vajra.management.part.mine.viewModel;

import java.util.List;
import java.util.Map;

import jgl.vajra.management.bean.HomeCarModelBean;
import jgl.vajra.management.bean.HomeMechanicsBean;
import jgl.vajra.management.part.mine.contract.CarAddContract;
import jgl.vajra.management.part.mine.model.CarAddModel;
import jgl.vajra.management.widget.mvvm.factory.CreateModel;
import jgl.vajra.management.widget.retrofithelper.rxsubscriber.ProgressObserver;

@CreateModel(CarAddModel.class)
public class CarAddViewModel extends CarAddContract.ViewModel{
    @Override
    public void getCarTypeData(Map<String, Object> map) {
        mModel.getCarTypeData(map).subscribe(new ProgressObserver<List<HomeMechanicsBean>>(false,null) {
            @Override
            public void _onNext(List<HomeMechanicsBean> homeMechanicsBean) {
                mView.returnCarTypeBean(homeMechanicsBean);
            }

            @Override
            public void _onError(String errorMessage, int errorCode) {
                super._onError(errorMessage, errorCode);
            }
        });
    }

    @Override
    public void getCarModelData(Map<String, Object> mapCarModel) {
        mModel.getCarModelData(mapCarModel).subscribe(new ProgressObserver<List<HomeCarModelBean>>(false,null) {
            @Override
            public void _onNext(List<HomeCarModelBean> data) {
                mView.returnHomeCarModelBean(data);
            }

            @Override
            public void _onError(String errorMessage, int errorCode) {
                super._onError(errorMessage, errorCode);
            }
        });
    }

    @Override
    public void getCarAddFeeData(Map<String, Object> map) {
        mModel.getCarAddFeeData(map).subscribe(new ProgressObserver<String>(false,null) {
            @Override
            public void _onNext(String data) {
                mView.returnCarAddFeeData(data);
            }

            @Override
            public void _onError(String errorMessage, int errorCode) {
                super._onError(errorMessage, errorCode);
            }
        });
    }
}
